/* GUI CONVERTED from rweamt.p (converter v1.75) Sat Aug 12 23:17:32 2000 */
/* rweamt.p - EARNINGS MASTER MAINTENANCE                               */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*V8:ConvertMode=Maintenance                                            */
/* REVISION: 9.1      LAST MODIFIED: 06/30/00   BY: *N0F1* Jean Miller  */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb          */


/* Program copied from preamt.p and modified to support just necessary  */
/* functionality when obsoleting Payroll                                */


      /*  DISPLAY TITLE  */
      {mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rweamt_p_1 "Piece Rate"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

      define variable del-yn like mfc_logical initial no.
      define variable fixed as decimal format "->>>.99" label {&rweamt_p_1}.
      define variable mult like ea_rate.
      define variable tdesc like ea_desc format "x(9)".

      /*  DISPLAY FORM  */

      
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
         
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
ea_earn         colon 30   skip(1)
         tdesc           colon 30
         ea_type         colon 30
         mult            colon 30
         "or" at 41
         fixed           colon 60
       SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



      setFrameLabels(frame a:handle).

      /*  DISPLAY  */
      view frame a.

      mainloop:
      repeat with frame a:
/*GUI*/ if global-beam-me-up then undo, leave.


         ststatus = stline[1].
         status input ststatus.

         prompt-for ea_earn editing:

            /*  FIND NEXT/PREVIOUS RECORD  */
            {mfnp.i ea_mstr ea_earn ea_earn
                    ea_earn ea_earn ea_earn}
            if recno <> ? then do:
               tdesc = ea_desc.
               display
                  ea_earn
                  tdesc
                  ea_type.
               if not ea_piece  then
                  display ea_rate @ mult "" @ fixed.
               else
                  display "" @ mult ea_rate @ fixed.
            end.

         end.

         /* ADD/MOD/DELETE */
         if input ea_earn = "" then do:
            {mfmsg.i 4025 3} /* INVALID EARNINGS CODE */
            undo mainloop.
         end.

         find ea_mstr using ea_earn no-error.

         if not available ea_mstr then do:
            {mfmsg.i 1 1}  /* ADDING NEW RECORD */
            create ea_mstr.
            assign ea_earn.
         end.

         /* STORE MODIFY DATE AND USERID */
         ea_mod_date = today.
         ea_userid = global_userid.

         recno = recid(ea_mstr).

         ststatus = stline[2].
         status input ststatus.
         del-yn = no.

         tdesc = ea_desc.
         display tdesc ea_type.
         if not ea_piece then
            display
               ea_rate @ mult
               ""      @ fixed.
         else
            display
               ""      @ mult
               ea_rate @ fixed.

         loopa:
         do on error undo, retry:
/*GUI*/ if global-beam-me-up then undo, leave.


            set tdesc ea_type mult go-on("F5" "CTRL-D") with frame a.

            /*  DELETE  */
            if lastkey = keycode("F5") or lastkey = keycode("CTRL-D")
            then do:
               del-yn = yes.
               {mfmsg01.i 11 1 del-yn}  /* CONFIRM DELETE */
               if del-yn = no then undo loopa.
            end.

            if del-yn then do:
               /* OK TO DELETE */
               delete ea_mstr.
               clear frame a.
/*GUI*/ RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
               del-yn = no.
               next mainloop.
            end.

            /* SET MULTIPLIER/PIECE FLAG */
            if mult = 0 then do:
               set fixed.
               assign
                  ea_mstr.ea_piece = yes
                  ea_mstr.ea_rate = fixed.
               if ea_mstr.ea_rate = 0 then ea_mstr.ea_piece = no.
            end.
            else do:
               assign
                  ea_mstr.ea_piece = no
                  ea_mstr.ea_rate = mult.
               display "" @ fixed.
            end.

         end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* loopa */

         ea_mstr.ea_desc = tdesc.

      end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* mainloop */

      status input.
